IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
	SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
ENDIF()

ExternalProject_Add( ANGELSCRIPT
	URL ${CMAKE_CURRENT_SOURCE_DIR}/angelscript-mirror-fc28a170134b.zip
	DOWNLOAD_EXTRACT_TIMESTAMP TRUE
	SOURCE_SUBDIR "sdk/angelscript/projects/cmake"
	CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
		-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
		-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
		-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
		-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
		-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
		-DBUILD_SHARED_LIBS=OFF
		-DAS_USE_STLNAMES=ON
		-DAS_ADDONS=stdstring|array|any|file|math|builder|filesystem|datetime|aswrappedcall|stdstring_utils
	LIST_SEPARATOR |
)
ExternalProject_Get_Property( ANGELSCRIPT INSTALL_DIR )
SET( ANGELSCRIPT_INSTALL_DIR ${INSTALL_DIR} )
